<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function NoRepeat1 ( arg ) { 
            var newArg = [] ;
            if (typeof arg == 'string' ) {
                for( var i = 0 ; i < arg.length ; i ++ ) {
                    if ( newArg.indexOf( arg[i] ) == -1 ){
                        newArg.push( arg[i] ) ; 
                    }
                }
                return newArg.join("") ; 
            } else if ( typeof arg == 'object' ){
                for( var i = 0 ; i < arg.length ; i ++ ) {
                    if ( newArg.indexOf( arg[i] ) == -1 ){
                        newArg.push( arg[i] ) ; 
                    }
                } 
                return newArg ; 
            }
        }
        var str = "abacdefgacdss";
        var arr1 = ["a","b","a","c","a","b","c","d","c"]
        var arr = [1,4,7,5,1,2,4,54,12,5,3,4,1,2];
        console.log(NoRepeat1(str));
        console.log(NoRepeat1(arr1));
        console.log(NoRepeat1(arr));
    </script>
</body>
</html>